import { zxcvbn, zxcvbnOptions, OptionsType } from "@zxcvbn-ts/core";
import * as zxcvbnCommonPackage from "@zxcvbn-ts/language-common";
import * as zxcvbnZhPackage from "./zxcvbn/language-zh";

const options: OptionsType = {
  dictionary: {
    ...zxcvbnCommonPackage.dictionary,
    ...zxcvbnZhPackage.dictionary,
  },
  graphs: zxcvbnCommonPackage.adjacencyGraphs,
  translations: zxcvbnZhPackage.translations,
};
zxcvbnOptions.setOptions(options);

export function passwordStrength(password: string) {
  return zxcvbn(password);
}
